package com.alan.server1.controller;

import cn.hutool.core.date.DateUtil;
import com.alan.share.bean.User;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Alan on 17-8-22
 */
@Slf4j
@RestController
@RequestMapping("test")
public class TestController {

//    @Value("${alan.test}")
//    private String test;

    @RequestMapping("test")
    public String test(String str){
        log.info("str="+str);
        return "hello "+str;
    }

    @RequestMapping("user")
    public String user(@RequestBody User user){
        log.info("str="+ JSON.toJSONString(user));
        System.out.println("time:"+ DateUtil.formatDateTime(user.getCreateTime()));
        return "hello OK";
    }

}
